import request from '@/utils/request'

export function get() {
  const params = {}
  return request({
    url: 'api/spiderWeb/queryAll',
    method: 'get',
    params
  })
}

export function queryById(webId) {
  return request({
    url: 'api/spiderWeb/queryById/' + webId,
    method: 'get'
  })
}

export function add(data) {
  return request({
    url: 'api/spiderWeb',
    method: 'post',
    data
  })
}

export function del(ids) {
  return request({
    url: 'api/spiderWeb/',
    method: 'delete',
    data: ids
  })
}

export function edit(data) {
  return request({
    url: 'api/spiderWeb',
    method: 'put',
    data
  })
}

export function spiderAction(data) {
  return request({
    url: 'api/spiderWeb/spiderAction',
    method: 'post',
    data
  })
}

export function spiderComicAction(data) {
  return request({
    url: 'api/spiderWeb/spiderComicAction',
    method: 'post',
    data
  })
}

export function spiderDetailAction(data) {
  return request({
    url: 'api/spiderWeb/spiderDetailAction',
    method: 'post',
    data
  })
}

export function spiderComicDetailAction(data) {
  return request({
    url: 'api/spiderWeb/spiderComicDetailAction',
    method: 'post',
    data
  })
}

export function spiderComicContentAction(data) {
  return request({
    url: 'api/spiderWeb/spiderComicContentAction',
    method: 'post',
    data
  })
}

export function resetRedisCache(webId) {
  return request({
    url: 'api/spiderWeb/resetRedisCache/' + webId,
    method: 'get'
  })
}

export function resetComicRedisCache(webId) {
  return request({
    url: 'api/spiderWeb/resetComicRedisCache/' + webId,
    method: 'get'
  })
}

export function cacheImgByWebId(webId) {
  return request({
    url: 'api/spiderWeb/cacheImgByWebId/' + webId,
    method: 'get'
  })
}

export function cacheComicImgByWebId(webId) {
  return request({
    url: 'api/spiderWeb/cacheComicImgByWebId/' + webId,
    method: 'get'
  })
}

export function cacheM3U8ByWebId(webId) {
  return request({
    url: 'api/spiderWeb/cacheM3U8ByWebId/' + webId,
    method: 'get'
  })
}

export function overwriteM3u8File(webId) {
  return request({
    url: 'api/spiderWeb/overwriteM3u8File/' + webId,
    method: 'get'
  })
}
export default { get, add, edit, del, queryById, spiderAction, spiderDetailAction, resetRedisCache, cacheImgByWebId, cacheM3U8ByWebId, overwriteM3u8File,
  spiderComicAction, spiderComicDetailAction, resetComicRedisCache, cacheComicImgByWebId, spiderComicContentAction }
